<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String baseBath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <title>Title</title>
</head>
<body>
<base href="<%=baseBath%>">
<div id="main" style="width: 600px;height:600px; float: left"></div>
<script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
<script src="../../js/jquery.min.js"></script>
<script>
    $(function () {
        function Cus(name,value) {
             this.name=name;
             this.value=value;
        }

        var myChart = echarts.init(document.getElementById('main'));
       $.post("tongji/findCustomerCount").done(function (data) {
           var cus=new Array();
          $.map(data,function (obj) {
           cus.push(new Cus(obj.name,obj.count));
          })
          myChart.setOption({
              title: {
                  text: '客户渠道占比',
                  left: 'center'
              },
              tooltip: {
                  trigger: 'item'
              },
              legend: {
                  orient: 'vertical',
                  left: 'left',
              },
              series: [
                  {
                      name: '访问来源',
                      type: 'pie',
                      radius: '50%',
                      data: cus,
                      emphasis: {
                          itemStyle: {
                              shadowBlur: 10,
                              shadowOffsetX: 0,
                              shadowColor: 'rgba(0, 0, 0, 0.5)'
                          }
                      }
                  }
              ]
          })
       })
    })
</script>
</body>
</html>
